package site.potatoblog.threadpool.manager.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.stereotype.Service;
import site.potatoblog.threadpool.manager.core.DynamicThreadPool;
import site.potatoblog.threadpool.manager.core.DynamicThreadPoolManager;
import site.potatoblog.threadpool.manager.vo.ThreadPoolArgs;
import site.potatoblog.threadpool.manager.vo.ThreadPoolDetailInfo;

import java.util.List;

@ConditionalOnBean(DynamicThreadPool.class)
@Service
public class ThreadPoolMangerService {
    @Autowired
    private DynamicThreadPoolManager threadPoolManager;

    public List<ThreadPoolArgs> getAllThreadPoolArgs(){
        return threadPoolManager.getAllThreadPoolArgs();
    }

    public ThreadPoolDetailInfo getThreadPoolDetailByName(String name){
        return threadPoolManager.getThreadPoolDetailByName(name);
    }

    public boolean updateThreadPool(ThreadPoolArgs threadPoolArgs) {
        return threadPoolManager.updateThreadPool(threadPoolArgs);
    }

}
